var rootPath=null;
var id=window.sessionStorage.getItem("id");
var name=window.sessionStorage.getItem("managername");
	//js获取项目根路径，如： http://localhost:8083/uimcardprj
rootPath=getRootPath();
var student={
	gender: null,		
	regions: null,		
	city: null,			
	examineeType: null,
	applyType: null,	
	testType: null,		
	volunteerOne:null,	
	promiseType: 1,	
	payType: null,		
	ticketType: null
};
$(document).ready(function() {
	// 加载初始化数据
	area("regions",1000);
	volunteer();
	$("#regions").change(function () {
		var options=$("#regions option:selected");
		var areaid=options.val();
		if(options.text()=="全部"){
			student.regions=null;
		}else{
			student.regions=options.text();
		}
		$("#city").empty();
		area("city",areaid);
		to_page(1,student);
	});
	$("#city").change(function () {
		var options=$("#city option:selected");
		if(options.text()=="全部"){
			student.city=null;
		}else{
			student.city=options.text();
		}
		to_page(1,student);
	});
	$("#examinee").change(function () {
		var options=$("#examinee option:selected");
		if(options.text()=="全部"){
			student.examineeType=null;
		}else{
			student.examineeType=options.val();
		}
		to_page(1,student);
	});
	$("#apply").change(function () {
		var options=$("#apply option:selected");
		if(options.text()=="全部"){
			student.applyType=null;
		}else{
			student.applyType=options.val();
		}
		to_page(1,student);
	});
	$("#test").change(function () {
		var options=$("#test option:selected");
		if(options.text()=="全部"){
			student.testType=null;
		}else{
			student.testType=options.val();
		}
		to_page(1,student);
	});
	$("#pay").change(function () {
		var options=$("#pay option:selected");
		if(options.text()=="全部"){
			student.payType=null;
		}else{
			student.payType=options.val();
		}
		to_page(1,student);
	});
	$("#ticket").change(function () {
		var options=$("#ticket option:selected");
		if(options.text()=="全部"){
			student.ticketType=null;
		}else{
			student.ticketType=options.val();
		}
		to_page(1,student);
	});
	$("#volunteer1").change(function () {
		var options=$("#volunteer1 option:selected");
		if(options.text()=="全部"){
			student.volunteerOne=null;
		}else{
			student.volunteerOne=options.text();
		}
		to_page(1,student);
	});
	to_page(1,student);
});
//地区列表联动
function area(id,areaid){
	$.ajax({
		type:"get",
		url:rootPath+"/getpid",
		data : "pid=" + areaid,
		async:true,
		success:function(areaM){
			var areaitem=areaM.extend.region;
			var areaOptionA=$("<option></option>").append("全部").attr("value","");
			$("#"+id).append(areaOptionA);
			for (var i=0;i<areaitem.length;i++) {
				var areaOption=$("<option></option>").append(areaitem[i].region).attr("value",areaitem[i].id);
				$("#"+id).append(areaOption);
			}
		}
	});
}
//删除数组指定值
function removeByValue(arr, val) {
  for(var i=0; i<arr.length; i++) {
    if(arr[i] == val) {
      arr.splice(i, 1);
      break;
    }
  }
}
//专业列表
function volunteer(){
	$.ajax({
		type:"get",
		url:rootPath+"/getArts",
		data :"section_type=0&overall_type=0&ids=0",
		async:true,
		success:function(volunteers){
			var vol=volunteers.extend.science;
			var volOptionA=$("<option></option>").append("全部").attr("value","");
			$("#volunteer1").append(volOptionA);
			for (var j=0;j<vol.length;j++) {
				var volOption=$("<option></option>").append(vol[j].major).attr("value",vol[j].id);
				$("#volunteer1").append(volOption);
			}
		}
	});
}
//加载分页信息
function to_page(pn,student) {
	//alert(JSON.stringify(student));
	var regions=student.regions;
	var gender=student.gender;	
	var city=student.city	;		
	var examineeType=student.examineeType;
	var applyType=student.applyType;
	var testType=student.testType;		
	var volunteerOne=student.volunteerOne;
	var promiseType= student.promiseType;
	var payType= student.payType;	
	var ticketType= student.ticketType;
	$.ajax({
		url : rootPath+"/getStudents",
		data :{
			pn:pn,
			gender: gender,		
			regions: regions,		
			city: city,			
			examineeType: examineeType,
			applyType: applyType,	
			testType:testType,		
			volunteerOne: volunteerOne,	
			promiseType:promiseType,	
			payType:payType,		
			ticketType:ticketType	
		},
		type : "POST",
		success : function(result) {
//			 console.log(result);
			// 1、解析并显示数据
			build_page_info(result);
			build_stu_table(result);
			// 3、解析显示分页条数据
			build_page_nav(result);
		}
	});
};
//解析信息插入表格
function build_stu_table(result) {
	// 清空table表格
	$("#tabRS tbody").empty();
	$("#num").empty();
	var total=result.extend.pageInfo.total;
	$("#num").append(total);
	var manager = result.extend.pageInfo.list;
	$.each(manager, function(index, item) {
		var idTd = $("<td></td>").append(item.id);
		var eamineeIdTd = $("<td></td>").append(item.eamineeId);
		var nameTd = $("<td></td>").append(item.name);
		var cardIdTd = $("<td></td>").append(item.cardId);
		var genderTd = null;
		if(item.gender==1){
			genderTd = $("<td></td>").append("男");
		}else if(item.gender==2){
			genderTd = $("<td></td>").append("女");
		}
		var nationTd = null;
		if(item.nation==null||item.nation==""){
			nationTd = $("<td></td>").append("无");
		}else{
			nationTd = $("<td></td>").append(item.nation);
		}
		var languagesTd = null;
		if(item.languages==1){
			languagesTd = $("<td></td>").append("英语");
		}else if(item.languages==2){
			languagesTd = $("<td></td>").append("其他");
		}else{
			languagesTd = $("<td></td>").append("无");
		}
		var provincesTd = null;
		if(item.provinces==null||item.provinces==""){
			provincesTd = $("<td></td>").append("无");
		}else{
			provincesTd = $("<td></td>").append(item.provinces);
		}
		var regionsTd = null;
		if(item.regions==null||item.regions==""){
			regionsTd = $("<td></td>").append("无");
		}else{
			regionsTd = $("<td></td>").append(item.regions);
		}
		var cityTd = null;
		if(item.city==null||item.city==""){
			cityTd = $("<td></td>").append("无");
		}else{
			cityTd = $("<td></td>").append(item.city);
		}
		var telephoneTd = null;
		if(item.telephone==null||item.telephone==""){
			telephoneTd = $("<td></td>").append("无");
		}else{
			telephoneTd = $("<td></td>").append(item.telephone);
		}
		var examineeTypeTd = null;
		if(item.examineeType==1){
			examineeTypeTd = $("<td></td>").append("城市应届");
		}else if(item.examineeType==2){
			examineeTypeTd = $("<td></td>").append("城镇往届");
		}else if(item.examineeType==3){
			examineeTypeTd = $("<td></td>").append("农村应届");
		}else if(item.examineeType==4){
			examineeTypeTd = $("<td></td>").append("农村往届");
		}else if(item.examineeType==5){
			examineeTypeTd = $("<td></td>").append("社会青年");
		}else{
			examineeTypeTd = $("<td></td>").append("无");
		}
		var applyTypeTd = null;
		if(item.applyType==2){
			applyTypeTd = $("<td></td>").append("理工");
		}else if(item.applyType==1){
			applyTypeTd = $("<td></td>").append("文史");
		}
		var testTypeTd = null;
		if(item.testType==1){
			testTypeTd = $("<td></td>").append("面试");
		}else if(item.testType==2){
			testTypeTd = $("<td></td>").append("机考");
		}else{
			testTypeTd = $("<td></td>").append("无");
		}
		var volunteerOneTd = null;
		if(item.volunteerOne==null||item.volunteerOne==""){
			volunteerOneTd = $("<td></td>").append("无");
		}else{
			volunteerOneTd = $("<td></td>").append(item.volunteerOne);
		}
		var volunteerTwoTd = null;
		if(item.volunteerTwo==null||item.volunteerTwo==""){
			volunteerTwoTd = $("<td></td>").append("无");
		}else{
			volunteerTwoTd = $("<td></td>").append(item.volunteerTwo);
		}
		var volunteerThreeTd = null;
		if(item.volunteerThree==null||item.volunteerThree==""){
			volunteerThreeTd = $("<td></td>").append("无");
		}else{
			volunteerThreeTd = $("<td></td>").append(item.volunteerThree);
		}
		var volunteerFourTd = null;
		if(item.volunteerFour==null||item.volunteerFour==""){
			volunteerFourTd = $("<td></td>").append("无");
		}else{
			volunteerFourTd = $("<td></td>").append(item.volunteerFour);
		}
		var volunteerFiveTd = null;
		if(item.volunteerFive==null||item.volunteerFive==""){
			volunteerFiveTd = $("<td></td>").append("无");
		}else{
			volunteerFiveTd = $("<td></td>").append(item.volunteerFive);
		}
		var mailingAddressTd = null;
		if(item.mailingAddress==null||item.mailingAddress==""){
			mailingAddressTd = $("<td></td>").append("无");
		}else{
			mailingAddressTd = $("<td></td>").append(item.mailingAddress);
		}
		var postalCodeTd = null;
		if(item.postalCode==null||item.postalCode==""){
			postalCodeTd = $("<td></td>").append("无");
		}else{
			postalCodeTd = $("<td></td>").append(item.postalCode);
		}
		var addresseeTd = null;
		if(item.addressee==null||item.addressee==""){
			addresseeTd = $("<td></td>").append("无");
		}else{
			addresseeTd = $("<td></td>").append(item.addressee);
		}
		var addrTeleTd = null;
		if(item.addrTele==null||item.addrTele==""){
			addrTeleTd = $("<td></td>").append("无");
		}else{
			addrTeleTd = $("<td></td>").append(item.addrTele);
		}
		var promiseTypeBtn = $("<button></button>").addClass(
				"btn btn-info btn-sm").append(
				$("<span></span>").addClass("glyphicon glyphicon-list-alt"))
				.append("&nbsp;承诺书");
		var promiseTypeTd=null;
		if(item.promiseType==1){
			promiseTypeTd = $("<td></td>").append(promiseTypeBtn);
			promiseTypeBtn.attr("href", null);
		}
		else if(item.promiseType==2){
			promiseTypeTd = $("<td></td>").append("未同意");
		}else{
			promiseTypeTd = $("<td></td>").append("无");
		}
		var payTypeTd = null;
		if(item.payType==1){
			payTypeTd = $("<td></td>").append("已缴费");
		}else if(item.payType==2){
			payTypeTd = $("<td></td>").append("未交费");
		}else{
			payTypeTd = $("<td></td>").append("无");
		}
		var ticketTypeTd = null;
		if(item.ticketType==1){
			ticketTypeTd = $("<td></td>").append("已打印");
		}else if(item.ticketType==2){
			ticketTypeTd = $("<td></td>").append("未打印");
		}else{
			ticketTypeTd = $("<td></td>").append("无");
		}
		var payTimeTd = null;
		if(item.payTime==null||item.payTime==""){
			payTimeTd = $("<td></td>").append("无");
		}else{
			var date = new Date(item.payTime)
			payTimeTd = $("<td></td>").append(date.getFullYear()+"年"+(date.getMonth()+1)+"月"+date.getDay()+"日"
			+date.getHours()+":"+date.getMinutes());
		}
		var ticketTimeTd = null;
		if(item.ticketTime==null||item.ticketTime==""){
			ticketTimeTd = $("<td></td>").append("无");
		}else{
			var date = new Date(item.ticketTime)
			ticketTimeTd = $("<td></td>").append(date.getFullYear()+"年"+(date.getMonth()+1)+"月"+date.getDay()+"日"
			+date.getHours()+":"+date.getMinutes());
		}
		var promiseTimeTd = null;
		if(item.payTime==null||item.payTime==""){
			promiseTimeTd = $("<td></td>").append("无");
		}else{
			var date = new Date(item.promiseTime)
			promiseTimeTd = $("<td></td>").append(date.getFullYear()+"年"+(date.getMonth()+1)+"月"+date.getDay()+"日"
			+date.getHours()+":"+date.getMinutes());
		}
		var delBtn = $("<button></button>").addClass(
				"btn btn-danger btn-sm delete_btn").append(
				$("<span></span>").addClass("glyphicon glyphicon-trash"))
				.append("&nbsp;删除");
		// 为删除按钮添加自定义属性，ID
		delBtn.attr("del-id", item.id);
		var doTd = $("<td></td>").append(delBtn);
		// append执行完成后返回原来的元素
		$("<tr></tr>").append(idTd).append(eamineeIdTd).append(nameTd).append(cardIdTd).append(genderTd).
		append(nationTd).append(languagesTd).append(provincesTd).append(regionsTd).
		append(cityTd).append(telephoneTd).append(examineeTypeTd).
		append(applyTypeTd).append(testTypeTd).append(volunteerOneTd).append(volunteerTwoTd).
		append(volunteerThreeTd).append(volunteerFourTd).append(volunteerFiveTd).append(mailingAddressTd).
		append(postalCodeTd).append(addresseeTd).append(addrTeleTd).append(promiseTypeTd).
		append(payTypeTd).append(ticketTypeTd).append(ticketTimeTd).append(payTimeTd).append(promiseTimeTd).append(doTd).appendTo("#tabRS tbody");
	});
};

// 删除按钮
$(document).on("click", ".delete_btn", function() {
	var name = $(this).parents("tr").find("td:eq(0)").text();
	var id = $(this).attr("del-id");
	if (confirm("确认删除【" + name + "】吗？")) {
		$.ajax({
			url : rootPath+"/delRole?roleid="+id,
			type : "DELETE",
			success : function(result) {
				alert(result.msg);
				// 回到本页
				to_page(currentPage,student);
			}
		});
	}
});
function find() {
	var ec = document.getElementById("name").value;
	if(ec==null||ec==""){
		to_page(1,student);
	}else{
		find_ec(ec);
	}
};
function find_ec(ec) {
	if(ec.length==14){
		$.ajax({
			url : rootPath+"/getStudentByEamineeId",
			data : "EamineeId=" + ec,
			type : "GET",
			success : function(result) {
				find_one(result);
			}
		});
	}else if(ec.length==18){
		$.ajax({
			url : rootPath+"/getStudentByCardId",
			data : "CardId=" + ec,
			type : "GET",
			success : function(result) {
				find_one(result);
			}
		});
	}else{
		alert("请输入正确的考生号或身份证号");
	}
};
function find_one(results) {
	$("#tabRS tbody").empty();
	var result=results.extend.student;
	var idTd = $("<td></td>").append(result.id);
		var eamineeIdTd = $("<td></td>").append(result.eamineeId);
		var nameTd = $("<td></td>").append(result.name);
		var cardIdTd = $("<td></td>").append(result.cardId);
		var genderTd = null;
		if(result.gender==1){
			genderTd = $("<td></td>").append("男");
		}else if(result.gender==0){
			genderTd = $("<td></td>").append("女");
		}
		var nationTd = null;
		if(result.nation==null||result.nation==""){
			nationTd = $("<td></td>").append("无");
		}else{
			nationTd = $("<td></td>").append(result.nation);
		}
		var languagesTd = null;
		if(result.languages==1){
			languagesTd = $("<td></td>").append("英语");
		}else if(result.languages==0){
			languagesTd = $("<td></td>").append("其他");
		}else{
			languagesTd = $("<td></td>").append("无");
		}
		var provincesTd = null;
		if(result.provinces==null||result.provinces==""){
			provincesTd = $("<td></td>").append("无");
		}else{
			provincesTd = $("<td></td>").append(result.provinces);
		}
		var regionsTd = null;
		if(result.regions==null||result.regions==""){
			regionsTd = $("<td></td>").append("无");
		}else{
			regionsTd = $("<td></td>").append(result.regions);
		}
		var cityTd = null;
		if(result.city==null||result.city==""){
			cityTd = $("<td></td>").append("无");
		}else{
			cityTd = $("<td></td>").append(result.city);
		}
		var telephoneTd = null;
		if(result.telephone==null||result.telephone==""){
			telephoneTd = $("<td></td>").append("无");
		}else{
			telephoneTd = $("<td></td>").append(result.telephone);
		}
		var examineeTypeTd = null;
		if(result.examineeType==1){
			examineeTypeTd = $("<td></td>").append("城市应届");
		}else if(result.examineeType==2){
			examineeTypeTd = $("<td></td>").append("城镇往届");
		}else if(result.examineeType==3){
			examineeTypeTd = $("<td></td>").append("农村应届");
		}else if(result.examineeType==4){
			examineeTypeTd = $("<td></td>").append("农村往届");
		}else if(result.examineeType==5){
			examineeTypeTd = $("<td></td>").append("社会青年");
		}else{
			examineeTypeTd = $("<td></td>").append("无");
		}
		var applyTypeTd = null;
		if(result.applyType==0){
			applyTypeTd = $("<td></td>").append("理工");
		}else if(result.applyType==1){
			applyTypeTd = $("<td></td>").append("文史");
		}
		var testTypeTd = null;
		if(result.testType==1){
			testTypeTd = $("<td></td>").append("面试");
		}else if(result.testType==0){
			testTypeTd = $("<td></td>").append("机考");
		}else{
			testTypeTd = $("<td></td>").append("无");
		}
		var volunteerOneTd = null;
		if(result.volunteerOne==null||result.volunteerOne==""){
			volunteerOneTd = $("<td></td>").append("无");
		}else{
			volunteerOneTd = $("<td></td>").append(result.volunteerOne);
		}
		var volunteerTwoTd = null;
		if(result.volunteerTwo==null||result.volunteerTwo==""){
			volunteerTwoTd = $("<td></td>").append("无");
		}else{
			volunteerTwoTd = $("<td></td>").append(result.volunteerTwo);
		}
		var volunteerThreeTd = null;
		if(result.volunteerThree==null||result.volunteerThree==""){
			volunteerThreeTd = $("<td></td>").append("无");
		}else{
			volunteerThreeTd = $("<td></td>").append(result.volunteerThree);
		}
		var volunteerFourTd = null;
		if(result.volunteerFour==null||result.volunteerFour==""){
			volunteerFourTd = $("<td></td>").append("无");
		}else{
			volunteerFourTd = $("<td></td>").append(result.volunteerFour);
		}
		var volunteerFiveTd = null;
		if(result.volunteerFive==null||result.volunteerFive==""){
			volunteerFiveTd = $("<td></td>").append("无");
		}else{
			volunteerFiveTd = $("<td></td>").append(result.volunteerFive);
		}
		var mailingAddressTd = null;
		if(result.mailingAddress==null||result.mailingAddress==""){
			mailingAddressTd = $("<td></td>").append("无");
		}else{
			mailingAddressTd = $("<td></td>").append(result.mailingAddress);
		}
		var postalCodeTd = null;
		if(result.postalCode==null||result.postalCode==""){
			postalCodeTd = $("<td></td>").append("无");
		}else{
			postalCodeTd = $("<td></td>").append(result.postalCode);
		}
		var addresseeTd = null;
		if(result.addressee==null||result.addressee==""){
			addresseeTd = $("<td></td>").append("无");
		}else{
			addresseeTd = $("<td></td>").append(result.addressee);
		}
		var addrTeleTd = null;
		if(result.addrTele==null||result.addrTele==""){
			addrTeleTd = $("<td></td>").append("无");
		}else{
			addrTeleTd = $("<td></td>").append(result.addrTele);
		}
		var promiseTypeBtn = $("<button></button>").addClass(
				"btn btn-info btn-sm").append(
				$("<span></span>").addClass("glyphicon glyphicon-list-alt"))
				.append("&nbsp;承诺书");
		var promiseTypeTd=null;
		if(result.promiseType==1){
			promiseTypeTd = $("<td></td>").append(promiseTypeBtn);
			promiseTypeBtn.attr("href", null);
		}
		else if(result.promiseType==0){
			promiseTypeTd = $("<td></td>").append("未同意");
		}else{
			promiseTypeTd = $("<td></td>").append("无");
		}
		var payTypeTd = null;
		if(result.payType==1){
			payTypeTd = $("<td></td>").append("已缴费");
		}else if(result.payType==0){
			payTypeTd = $("<td></td>").append("未交费");
		}else{
			payTypeTd = $("<td></td>").append("无");
		}
		var ticketTypeTd = null;
		if(result.ticketType==1){
			ticketTypeTd = $("<td></td>").append("已打印");
		}else if(result.ticketType==0){
			ticketTypeTd = $("<td></td>").append("未打印");
		}else{
			ticketTypeTd = $("<td></td>").append("无");
		}
		var payTimeTd = null;
		if(result.payTime==null||result.payTime==""){
			payTimeTd = $("<td></td>").append("无");
		}else{
			var date = new Date(result.payTime)
			payTimeTd = $("<td></td>").append(date.getFullYear()+"年"+(date.getMonth()+1)+"月"+date.getDay()+"日"
			+date.getHours()+":"+date.getMinutes());
		}
		var ticketTimeTd = null;
		if(result.ticketTime==null||result.ticketTime==""){
			ticketTimeTd = $("<td></td>").append("无");
		}else{
			var date = new Date(result.ticketTime)
			ticketTimeTd = $("<td></td>").append(date.getFullYear()+"年"+(date.getMonth()+1)+"月"+date.getDay()+"日"
			+date.getHours()+":"+date.getMinutes());
		}
		var promiseTimeTd = null;
		if(result.payTime==null||result.payTime==""){
			promiseTimeTd = $("<td></td>").append("无");
		}else{
			var date = new Date(result.promiseTime)
			promiseTimeTd = $("<td></td>").append(date.getFullYear()+"年"+(date.getMonth()+1)+"月"+date.getDay()+"日"
			+date.getHours()+":"+date.getMinutes());
		}
		var delBtn = $("<button></button>").addClass(
				"btn btn-danger btn-sm delete_btn").append(
				$("<span></span>").addClass("glyphicon glyphicon-trash"))
				.append("&nbsp;删除");
		// 为删除按钮添加自定义属性，ID
		delBtn.attr("del-id", result.id);
		var doTd = $("<td></td>").append(delBtn);
		// append执行完成后返回原来的元素
		$("<tr></tr>").append(idTd).append(eamineeIdTd).append(nameTd).append(cardIdTd).append(genderTd).
		append(nationTd).append(languagesTd).append(provincesTd).append(regionsTd).
		append(cityTd).append(telephoneTd).append(examineeTypeTd).
		append(applyTypeTd).append(testTypeTd).append(volunteerOneTd).append(volunteerTwoTd).
		append(volunteerThreeTd).append(volunteerFourTd).append(volunteerFiveTd).append(mailingAddressTd).
		append(postalCodeTd).append(addresseeTd).append(addrTeleTd).append(promiseTypeTd).
		append(payTypeTd).append(ticketTypeTd).append(ticketTimeTd).append(payTimeTd).append(promiseTimeTd).append(doTd).appendTo("#tabRS tbody");
};

// 解析分页信息
function build_page_info(result) {
	totalRecord = result.extend.pageInfo.total;
	currentPage = result.extend.pageInfo.pageNum;
}
// 分页条
function build_page_nav(result) {
	// 清空分页条
	$("#page_nav_area").empty();
	// page_nav_area
	var ul = $("<ul></ul>").addClass("pagination");

	var firstPageLi = $("<li></li>").append(
			$("<a></a>").append("首页").attr("href", "#"));
	var prePageLi = $("<li></li>").append($("<a></a>").append("&laquo;"));
	// 判断是否有前一页，没有，就不能点击《disabled》
	if (result.extend.pageInfo.hasPreviousPage == false) {
		firstPageLi.addClass("disabled");
		prePageLi.addClass("disabled");
	} else {
		// 为元素添加点击翻页事件
		firstPageLi.click(function() {
			to_page(1,student);
		});
		prePageLi.click(function() {
			to_page(result.extend.pageInfo.pageNum - 1,student);
		});
	}

	var nextPageLi = $("<li></li>").append($("<a></a>").append("&raquo;"));
	var lastPageLi = $("<li></li>").append(
			$("<a></a>").append("末页").attr("href", "#"));
	// 判断是否有下一页，没有，就不能点击《disabled》
	if (result.extend.pageInfo.hasNextPage == false) {
		nextPageLi.addClass("disabled");
		lastPageLi.addClass("disabled");
	} else {
		// 为元素添加点击翻页事件

		nextPageLi.click(function() {
			to_page(result.extend.pageInfo.pageNum + 1,"");
		});
		lastPageLi.click(function() {
			to_page(result.extend.pageInfo.pages,"");
		});
	}

	// 添加首页和前一页 的提示
	ul.append(firstPageLi).append(prePageLi);
	// 1.2.3.4.5 遍历给ul中添加页码提示
	$.each(result.extend.pageInfo.navigatepageNums, function(index, item) {

		var numLi = $("<li></li>").append($("<a></a>").append(item));
		// 显示当前页
		if (result.extend.pageInfo.pageNum == item) {
			numLi.addClass("active");
		}
		// 绑定单机事件
		numLi.click(function() {
			to_page(item,student);
		});
		ul.append(numLi);
	});
	// 添加下一页和末页 的提示
	ul.append(nextPageLi).append(lastPageLi);

	// 把ul加入到nav
	var navEle = $("<nav></nav>").append(ul);
	navEle.appendTo("#page_nav_area");
}
